Skip to content

Conversation

@pablospe
Copy link
Contributor

@pablospe pablospe commented Jan 6, 2026

Summary

  • Click on files in the tree to select them
  • Scroll wheel works in both file tree and diff viewer panes
  • Drag the border between panes to resize sidebar
  • Click on the filter box to enter search mode
  • Click on search results to select a file

@dlvhdr
Copy link
Owner

dlvhdr commented Jan 6, 2026

My god, this is great!
Do you think the code would be simpler if we use something like https://github.com/lrstanley/bubblezone? I've used it in my other projects and it's been great

@pablospe
Copy link
Contributor Author

pablospe commented Jan 6, 2026

Please take another look! The bubblezone dependency requires Go 1.23.0. When I ran go get github.com/lrstanley/bubblezone, it automatically upgraded.

Copy link
Owner

@dlvhdr dlvhdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! I left some suggestions for you to think about. Let me know what you think and how we should proceed.

@pablospe
Copy link
Contributor Author

pablospe commented Jan 7, 2026

I fixed the conflicts with a rebase and then git push --force. I think github is showing duplicates? (hmm... I am not sure).

I would recommend to set merge squash as the only option for merging against main in the github settings, so one PR is one commit in main, and it is easier to revert and follow the changes.

Create a rule for the main branch:
image

then:
image

- Click on files in the tree to select them
- Scroll wheel works in both file tree and diff viewer panes
- Drag the border between panes to resize sidebar
- Add bubblezone dependency for zone-based click detection
- Mark UI zones (searchbox, filetree, searchresults, diffviewer)
- Replace coordinate-based checks with zone.InBounds()
- Use zone.Pos() for relative coordinates in click handlers
- Keep hybrid approach for sidebar resize (coordinate-based)
- Update FileNode to implement new tree.Node interface
Add SetCursorNoScroll method to filetree that updates selection
without scrolling the viewport. Use it in handleFileTreeClick so
the view stays in place when clicking a visible file.
Consolidate duplicate root-hidden checks into a single reusable method.
Also fixes inconsistency where one check used '.' and another used
dirIcon+'.' - now all use the correct dirIcon+'.' check.
When user drags sidebar width below 10px, automatically hide it.
Pressing 'e' to show the tree again resets to default width (26).
Allow dragging the sidebar back open by clicking and dragging
the thin vertical line that remains when sidebar is hidden.
Add constants for sidebar constraints and scroll speed:
- sidebarMinWidth (20)
- sidebarHideWidth (10)
- scrollLines (3)

Also add comment explaining Width(0) for grab line.
@pablospe
Copy link
Contributor Author

pablospe commented Jan 8, 2026

I resolved the conflicts, please take another look.

@dlvhdr
Copy link
Owner

dlvhdr commented Jan 9, 2026

I fixed the conflicts with a rebase and then git push --force. I think github is showing duplicates? (hmm... I am not sure).

that's my bad. I haven't set the repo properly (it's new compared to my others).
Will fix now

@dlvhdr dlvhdr merged commit 8d516cd into dlvhdr:main Jan 9, 2026
@pablospe pablospe deleted the mouse-support branch January 9, 2026 21:39
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jan 12, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [dlvhdr/diffnav](https://github.com/dlvhdr/diffnav) | minor | `v0.3.1` → `v0.4.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>dlvhdr/diffnav (dlvhdr/diffnav)</summary>

### [`v0.4.0`](https://github.com/dlvhdr/diffnav/releases/tag/v0.4.0)

[Compare Source](dlvhdr/diffnav@v0.3.1...v0.4.0)

### Switch focus between panes, config file, mouse support and more!

This release is brought to you by [@&#8203;pablospe](https://github.com/pablospe) who made some serious improvements across the board!
Thank you [@&#8203;pablospe](https://github.com/pablospe), your work is really appreciated! <3

#### Focus Switching

You can now switch focus between the file tree and the diff by hitting <kbd>tab</kbd>.
This lets you use a wider set of movement keybinds like actually navigating one line at a time with <kbd>j/k</kbd>.

#### Config File

`diffnav` now has a config file (check the readme on how to set it up).
It lets you hide the footer/header, hide the file tree by default or set its width.

#### Mouse Support

You can now click the files in the tree or scroll the diff with your mouse!

Again, this was all done by [@&#8203;pablospe](https://github.com/pablospe) so give him some love!

#### Changelog

- [`ccb29e8`](dlvhdr/diffnav@ccb29e8) Revert "fix: prevent j/k from scrolling inactive panel"
- [`3a431de`](dlvhdr/diffnav@3a431de) chore: add funding configuration for GitHub
- [`37a52c1`](dlvhdr/diffnav@37a52c1) feat: add config option to hide header
- [`e5efc99`](dlvhdr/diffnav@e5efc99) feat: add more config options
- [`8d516cd`](dlvhdr/diffnav@8d516cd) feat: add mouse support ([#&#8203;49](dlvhdr/diffnav#49))
- [`60f5aa3`](dlvhdr/diffnav@60f5aa3) feat: add panel switching with h/l and arrow keys
- [`bfc0ef1`](dlvhdr/diffnav@bfc0ef1) feat: convert config to YAML and nest under ui key
- [`600d8ed`](dlvhdr/diffnav@600d8ed) feat: improve config file discovery
- [`090abfc`](dlvhdr/diffnav@090abfc) feat: make ctrl+d/ctrl+u global for diff scrolling
- [`23b3000`](dlvhdr/diffnav@23b3000) feat: replace h/l panel switching with Tab toggle
- [`d6b2e73`](dlvhdr/diffnav@d6b2e73) fix: improve file tree selection styling
- [`cad6633`](dlvhdr/diffnav@cad6633) fix: isolate panel navigation to prevent cross-scrolling
- [`803f7a8`](dlvhdr/diffnav@803f7a8) fix: prevent delta colors from bleeding into file tree panel
- [`a07e104`](dlvhdr/diffnav@a07e104) fix: prevent j/k from scrolling inactive panel
- [`f5f8972`](dlvhdr/diffnav@f5f8972) refactor: use ansi.Truncate instead of custom implementation
- [`e939dcf`](dlvhdr/diffnav@e939dcf) refactor: use camelCase for config keys
- [`08a7356`](dlvhdr/diffnav@08a7356) style: capitalize TAB in footer help

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi43NS4xIiwidXBkYXRlZEluVmVyIjoiNDIuNzUuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants